import { useEventListener } from '@/hooks/event/useEventListener';

export const chartResize = (chartInstance: any) => {
  useEventListener({
    el: window,
    name: 'resize',
    listener: () => {
      if (Array.isArray(chartInstance)) {
        chartInstance.forEach((item: any) => {
          item?.resize();
        })
      } else {
        chartInstance?.resize();
      }
    },
    wait: 100,
    options: true,
  });
  // window.dispatchEvent(new Event('resize'))
}